<template>
  <div>

    <h2>state.count值: {{this.$store.state.count}}</h2>

    <!-- 3.调用Mutation中的方法 -->
    <button @click="increment(2)">add</button>
    <button @click="decrement(1)">del</button>
  </div>
</template>

<script>
  //1.导入mapMutations辅助函数
  import {mapMutations} from 'vuex';

  export default {
    name: "MutateTest",
    methods: {
      //2.映射Mutation中的方法
      ...mapMutations(['increment', 'decrement'])
    },
  }
</script>

<style scoped>

</style>
